function [avechannel,count_inter,count_intra]=channel_analysis(N,K,hGA,hGG)
% mm=1;nn=1;kk=4;hh=fSG{nn,kk};sqrt(hh'*hh)
%%
sumsum=0;
for nn=1:N
    hh=hGA{nn};
    sumsum = sumsum + sqrt(hh'*hh);
end
avechannel.avehGA=sumsum/N;

count_inter=0;
count_intra=0;
sumsuminter=0;
sumsumintra=0;
for nn=1:N
    for kk=1:K
        for mm=1:N
            if mm==nn
                hh=hGG{mm,nn,kk};
                sumsumintra = sumsumintra + sqrt(hh'*hh);
                count_intra = count_intra + 1;
            else
                hh=hGG{mm,nn,kk};
                sumsuminter = sumsuminter + sqrt(hh'*hh);
                count_inter = count_inter + 1;
            end
        end
    end
end
avechannel.avehGGintracell=sumsumintra/count_intra;
avechannel.avehGGintercell=sumsuminter/count_inter;
end
